package com.upf1sh.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.upf1sh.bean.PigData;
import com.upf1sh.service.PigDataService;
import com.upf1sh.utils.Result;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @Description:
 * @Title: PigDataCtrl
 * @Package com.upf1sh.controller
 * @Author: ZhaoXu
 * @CreateTime: 2025/8/14 21:13
 */
@RestController
@RequestMapping("/system/data")
public class PigDataCtrl {

    @Autowired
    private PigDataService pigDataService;

    /**
     * 查询【请填写功能名称】列表
     */

    @GetMapping("/list")
    public Result list(PigData pigData)
    {

        IPage<PigData> list = pigDataService.selectPigDataList(pigData);
        return  Result.ok().data("data", list);
    }


    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public Result  getInfo(@PathVariable("id") Long id)
    {
        return  Result.ok().data("data",pigDataService.selectPigDataByCate3(id));
    }

    /**
     * 新增【请填写功能名称】
     */
   @PostMapping
    public Result add(@RequestBody PigData pigData)
    {
        return  Result.ok().data("data",pigDataService.insertPigData(pigData));
    }

    /**
     * 修改【请填写功能名称】
     */
     @PutMapping
    public Result edit(@RequestBody PigData pigData)
    {
        return  Result.ok().data("data",pigDataService.updatePigData(pigData));
    }

    /**
     * 删除【请填写功能名称】
     */
   @DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return  Result.ok().data("data",pigDataService.deletePigDataByCate3s(ids));
    }
}
